﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Web.UI.WebControls;

namespace NotAClue.Web
{
    public static class StringExtensionMethods
    {
        /// <summary>
        /// Gets the values list.
        /// </summary>
        /// <param name="values">The values.</param>
        /// <returns></returns>
        public static ListItem[] GetValuesList(this String values)
        {
            var items = values.Split(new char[] { ',', ';' });
            var listItems = (from item in items
                             select new ListItem()
                             {
                                 Text = item.Split(new char[] { '|' })[1],
                                 Value = item.Split(new char[] { '|' })[0]
                             }).ToArray();
            return listItems;
        }
    }
}
